Ext.define('App.datasource.model.TableFieldViewModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.TableFieldViewModel',
    requires: ['App.datasource.model.TableFieldModel'],
    data: {
        columns: [{
            header: 'ID',
            dataIndex: 'id',
            hidden: true
        }, {
            header: '字段名称',
            dataIndex: 'alias'
        }, {
            header: '字段',
            dataIndex: 'fieldName'
        }, {
            header: '数据类型',
            dataIndex: 'dataType'
        }, {
            header: '条件',
            dataIndex: 'conditions'
        }],
        search: {
            simpleSearch: true,
            advancedSearch: true,
            fields: [{
                "field": "fieldName",
                "name": "字段",
                opt: 'like'
            }, {
                "field": "dataType",
                "name": "数据类型",
                opt: 'like'
            }]
        }
    },
    stores: {
        Query: {
            autoLoad: false,
            model: 'App.datasource.model.TableFieldModel',
            pageSize: 25,
            remoteSort: true,
            proxy: {
                type: 'majax',
                url: 'table_field/query',
                reader: {
                    type: 'json',
                    rootProperty: 'data',
                    totalProperty: 'total'
                }
            }
        }
    }
})